package com.itheima.test4;

import java.io.*;

/**
 * @Author:gy
 * @Date: 2025/08/31 14:35
 * @Description:
 */
public class Demo3 {
    public static void main(String[] args) throws Exception {
        //首先我们得有一个字节流
        FileInputStream fis = new FileInputStream("D:\\班级\\93期\\day11-IO\\a.txt");
        InputStreamReader ir = new InputStreamReader(fis, "GBK");

        int ch;
        while ((ch = ir.read()) != -1) {
            System.out.println((char)ch);
        }
        //关流
        fis.close();
        ir.close();
        //
        System.out.println("==================");
        OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("D:\\班级\\93期\\day11-IO\\a.txt"), "GBK");
        osw.write("我爱学习,天天学习");
        osw.close();
    }
}
